﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace OnlineCooperation
{
    public partial class FileTree : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["UserID"] == null || Session["UserID"].ToString() == "")
            {
                Response.Write("<script>alert('用户尚未登录！');window.location='Login.aspx';</script>");
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {


            if (FileUpload1.HasFile)
            {
                //判断文件是否小于16Mb  
                if (FileUpload1.PostedFile.ContentLength < 16777216)
                {
                    try
                    {
                        //上传文件并指定上传目录的路径 
                        string path = Session["CurrentDir"] + FileUpload1.FileName;
                        path = Server.UrlDecode(path);
                        FileUpload1.PostedFile.SaveAs(path);
                        Response.Write("<script>alert('文件上传成功！')</script>");
                    }
                    catch (Exception ex)
                    {
                        string Text = "出现异常,无法上传!" + ex.Message;
                        Response.Write("<script>alert('" + Text + "')</script>");
                    }

                }
                else
                {
                    Response.Write("<script>alert('文件不能大于16M！')</script>");
                }
            }
            else
            {
                Response.Write("<script>alert('请选择一个文件！')</script>");
            }
        }

        protected void BtnDl2_Click(object sender, EventArgs e)
        {
            
        }

        
    }
}